/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pkg10100;

import java.util.*;
import java.text.*;
import java.math.*;
import java.lang.*;
import java.io.*;

public class Main {

    BufferedReader reader;
    int[][] cando;

    public static void main(String[] args) throws IOException {
        Main ob = new Main();
        ob.run();
        System.exit(0);
    }

    public void run() throws IOException {
       // reader = new BufferedReader(new FileReader("in.txt"));
        reader = new BufferedReader( new InputStreamReader(System.in) );
        String[] line = new String[2];
        int cases = 1;
        while ((line[0] = reader.readLine()) != null) {
            line[1] = reader.readLine();
            doit(line, cases);
            ++cases;
        }
    }

    public void doit(String[] line, int cases) throws IOException {
        System.out.format("%2d", cases);
        if (line[0].length() < 1 || line[1].length() < 1) {
            System.out.println(". Blank!");
            return;
        }
        String[] _s1 = line[0].split("[^a-zA-Z0-9]");
        String[] _s2 = line[1].split("[^a-zA-Z0-9]");
        String[] s1 = new String[_s1.length];
        String[] s2 = new String[_s2.length];
        int m = 0, n = 0;
        for (String e : _s1) {
            String tmp = e.trim();
            if (tmp.length() < 1) {
                continue;
            }
            s1[m] = tmp;
            ++m;
        }
        for (String e : _s2) {
            String tmp = e.trim();
            if (tmp.length() < 1) {
                continue;
            }
            s2[n] = tmp;
            ++n;
        }
        cando = new int[m + 100][n + 100];
        for (int i = 0; i <= m; ++i) {
            Arrays.fill(cando[i], 0);
        }
        for (int i = 1; i <= m; ++i) {
            for (int j = 1; j <= n; ++j) {
                if (s1[i - 1].compareTo(s2[j - 1]) == 0) {
                    cando[i][j] = cando[i - 1][j - 1] + 1;
                } else {
                    cando[i][j] = Math.max(cando[i - 1][j], cando[i][j - 1]);
                }
            }
        }
        System.out.println(". Length of longest match: " + cando[m][n]);
    }
}
